﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ClientAPI;

namespace FrankenSteamClient
{
    /// <summary>
    /// Interaction logic for LoginWindow.xaml
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            ClientAPI.ClientAPI.Connect("E1015P07");
            InitializeComponent();            
        }

        private void btnSneakyLogin_Click(object sender, RoutedEventArgs e)
        {
           
        }

        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {

            if (ClientAPI.ClientAPI.Login(txtUserName.Text, txtPassword.Text))
            {
                MainWindow mainWindow = new MainWindow();
                mainWindow.Show();
                this.Close();
            }
           
            else
            {
                string messageBoxText = "Error! Connection Refused";
                string caption = "FRANKENSTEAM";
                MessageBoxButton button = MessageBoxButton.OKCancel;
                MessageBoxImage icon = MessageBoxImage.Information;
                MessageBox.Show(messageBoxText, caption, button, icon);
            }
        }

        private void btnRegUser_Click(object sender, RoutedEventArgs e)
        {
            ClientAPI.ClientAPI.Create(txtRegUserName.Text, txtRegPassword.Text, txtRegRepPassword.Text, txtRegEmail.Text);
            string messageBoxText = "Registered!";
            string caption = "FRANKENSTEAM";
            MessageBoxButton button = MessageBoxButton.OKCancel;
            MessageBoxImage icon = MessageBoxImage.Information;
            MessageBox.Show(messageBoxText, caption, button, icon);
        }
                      
    }
}
